<template>
	<view>
		
		<view class="center-second mtlr30">
			<view class="mtlr30">
				<view class="pt30" style="display: flex;justify-content: space-between;">
					<view style="color:#3ACD90;font-size: 30rpx;">当前业绩总和</view>
				</view>
				<view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
					<view class="mt30 fbold" style="font-size: 50rpx;">{{ totalMoney}}</view>
				</view>
		
		
			</view>
		</view>
		
		<view style="display: flex;">
			<view class="center-second mtlr30" style="width: 50%">
				<view class="mtlr30" >
					<view class="pt30">
						<view>加盟店业绩</view>
					</view>
					<view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
						<view class="mt30" style="font-size: 50rpx;">{{ jiamengdianyeji }}</view>
					</view>
				</view>
				
			</view>
      <!--
        <view class="center-second" style="width: 50%;margin-right: 30rpx;">
          <view class="mtlr30" >
            <view class="pt30">
              <view>代理业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ dailiyeji}}</view>
            </view>
          </view>

        </view>
      </view>


      <view style="display: flex;">
        <view class="center-second mtlr30" style="width: 50%">
          <view class="mtlr30" >
            <view class="pt30">
              <view>城市合伙人业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ chensghiyeji}}</view>
            </view>
          </view>

        </view>

        <view class="center-second" style="width: 50%;margin-right: 30rpx;">
          <view class="mtlr30" >
            <view class="pt30">
              <view>社区业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ shequyeji }}</view>
            </view>
          </view>

        </view>
      </view>

      <view style="display: flex;">
        <view class="center-second mtlr30" style="width: 50%">
          <view class="mtlr30" >
            <view class="pt30">
              <view>品牌使用费业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ pinpaiyeji }}</view>
            </view>
          </view>

        </view>

        <view class="center-second" style="width: 50%;margin-right: 30rpx;">
          <view class="mtlr30" >
            <view class="pt30">
              <view>我店生活业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ wodianyeji}}</view>
            </view>
          </view>

        </view>
      </view>

      <view style="display: flex;">
        <view class="center-second mtlr30" style="width: 50%">
          <view class="mtlr30" >
            <view class="pt30">
              <view>其他业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ otheryeji }}</view>
            </view>
          </view>

        </view>

        <view class="center-second" style="width: 50%;margin-right: 30rpx;">
          <view class="mtlr30" >
            <view class="pt30">
              <view>选品官业绩</view>
            </view>
            <view class="flex-center" style="display: flex;padding-bottom: 24rpx;">
              <view class="mt30" style="font-size: 50rpx;">{{ xuanpinguanyeji }}</view>
            </view>
          </view>

        </view>
      </view>
       -->
		
	</view>
	</view>
</template>

<script>
	import {
		dataDetail
	} from "@/common/apis/other.js"
	
	export default {
		name:"yeji",
		props:{
			date: {
				default: '',
				type: String
			},
			selected: {
				default: 'person',
				type: String
			},
		},
		data(){
			return {
				totalMoney:0.0,
				jiamengdianyeji:'暂无信息',
				dailiyeji:"暂无信息",
				chensghiyeji:"暂无信息",
				shequyeji:"暂无信息",
				pinpaiyeji:"暂无信息",
				wodianyeji:"暂无信息",
				otheryeji:"暂无信息",
				xuanpinguanyeji:"暂无信息",
			}
		},
		watch: {
			date: {
				handler(newInfo) {
					// 当 info 发生变化时，可以在这里进行处理
					console.log('info 变化:', newInfo);
					this.getDataDetail(newInfo)
				}
			},
			selected: {
				handler(newInfo) {
					// 当 info 发生变化时，可以在这里进行处理
					console.log('info 变化:', newInfo);
					console.log('date',this.date)
					this.getDataDetail(this.date)
				}
			}
		},
		methods:{
			getDataDetail(date){
				console.log("this is getDataDetail call")
				var that = this
				let params = {}
				if(this.selected == 'team'){
					params = {
						date:date,
						query_team :1
					}
					dataDetail(params).then( res =>{
						let result = res.data
						if(res.status == 200){
							console.log(11111)
							that.totalMoney = result.team.totalRewardPoints
							that.jiamengdianyeji = result.team.storeRewardPoints
							that.dailiyeji = result.team.agent
							that.chensghiyeji = result.team.cityPartner
							that.shequyeji = result.team.community
							// that.$set(that.detailInfo, 'totalMoney', result.total)
						}
					})
				}else{
					params = {
						date:date,
					}
					dataDetail(params).then( res =>{
						let result = res.data
						if(res.status == 200){
							console.log(11111)
							that.totalMoney = result.person.totalRewardPoints
							that.jiamengdianyeji = result.person.storeRewardPoints
							that.dailiyeji = result.person.agent
							that.chensghiyeji = result.person.cityPartner
							that.shequyeji = result.person.community
							// that.$set(that.detailInfo, 'totalMoney', result.total)
						}
					})
				}
				
				
			}
		}
		
	}
</script>

<style scoped>
	
	.center-second{
		margin-top: 20rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		padding-bottom: 40rpx;
	}

</style>